Page({

  /**
   * 页面的初始数据
   */
  data: {
    'result': -1,
    'visibility': false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {

  },

  onSubmit: function (e: WechatMiniprogram.FormSubmit) {
    const p1 = parseFloat(e.detail.value.p1)
    const p2 = parseFloat(e.detail.value.p2)
    this.setData({
      result: p1 + p2
    })
    this.changeVisibility(true)
  },

  changeVisibility(visible: boolean) {
    this.setData({
      visibility: visible,
    })
  },

  onEdit: function () {
    this.changeVisibility(false)
  }

})